/*********************************************************************************
FileName: definitions.h

Description: header avec les definitions des macros que nous avons crees

Authors: Vincent Leger et Francisco Jesus Ramos Reyes

Last Modification: 28-10-2012

Modifications: --
*********************************************************************************/

#ifndef _DEFINITIONS_H_
#define _DEFINITIONS_H_

/***************MACROS DE TEST ET DEBUG UNIQUEMENT*******************************/
//todo: remove after tests
//#define DEBUG_MODE  1   //COMMENT THIS LINE TO DISABLE DEBUG MESSAGES
#ifdef DEBUG_MODE
    #define DEBUG_MESSAGE(msg)          printk(KERN_WARNING msg"\n")
    #define DEBUG_VALUE(msg,value)      printk(KERN_WARNING msg"%d\n",(int)value)
    #define DEBUG_CHARACTER(msg,value)  printk(KERN_WARNING msg"%c\n",(char)value)
#else
    #define DEBUG_MESSAGE(msg)          (void)0
    #define DEBUG_VALUE(msg,value)      (void)0
    #define DEBUG_CHARACTER(msg,value)  (void)0
#endif
/*******************************************************************************/

/**********************DEFINITIONS DE MACROS************************************/
//#define DRIVER_NAME         "etsele_cdev"    //this name is required for the device to work on the scool's workbench
#define DRIVER_NAME         "TheBuffer"


#define READWRITE_BUFSIZE	16
#define DEFAULT_BUFSIZE		256
#define MAX_BUFSIZE         2500
#define MAX_READERS         2000	//have to put a maximum somewhere... else number reader variable could overflow at some point
#define MAX_WRITERS         1
#define CHAR_NUM            6

//IOCTL definitions
#define THEBUFFER_IOCTL_MAGIC_NO        'V'
#define THEBUFFER_IOCTL_MAXVALUE        4
#define THEBUFFER_IOCTL_RESET           _IO(THEBUFFER_IOCTL_MAGIC_NO, 0)
#define THEBUFFER_IOCTL_GET_QTY_DATA    _IOR(THEBUFFER_IOCTL_MAGIC_NO, 1, int)   //GetNumData
#define THEBUFFER_IOCTL_GET_QTY_READER  _IOR(THEBUFFER_IOCTL_MAGIC_NO, 2, int)   //GetNumReader
#define THEBUFFER_IOCTL_GET_BUFFERSIZE  _IOR(THEBUFFER_IOCTL_MAGIC_NO, 3, int)   //GetBufSize
#define THEBUFFER_IOCTL_SET_BUFFERSIZE  _IOR(THEBUFFER_IOCTL_MAGIC_NO, 4, int)   //SetBufSize


MODULE_AUTHOR("V. Leger, F. Ramos");
MODULE_LICENSE("Dual BSD/GPL");


#endif /* _DEFINITIONS_H_ */

